# author: SA12226114(Xin Zhu) SA12226139(Dan Shu)

# set compile arguments
CC = gcc
CFLAGS = -g

# avoid warning info about "up to date"
.PHONY: target

# generate object file and execute file
target: dbclient.o dbserver.o dbapi.o util.o
	$(CC) $(CFLAGS) dbclient.o dbapi.o util.o -ltokyocabinet -o dbclient
	$(CC) $(CFLAGS) dbserver.o dbapi.o util.o -ltokyocabinet -o dbserver
	@echo "====================================================================="
	@echo "=                        compile successfully                       ="
	@echo "====================================================================="

dbclient.o:
	$(CC) $(CFLAGS) -c dbclient.c -o dbclient.o

dbserver.o:
	$(CC) $(CFLAGS) -c dbserver.c -o dbserver.o

dbapi.o:
	$(CC) $(CFLAGS) -c dbapi.c -o dbapi.o

main.o: 
	$(CC) $(CFLAGS) -c main.c -o main.o

util.o:
	$(CC) $(CFLAGS) -c util.c -o util.o

# clean rubbish
clean:
	rm -f *.o *.hdb dbclient dbserver
	@echo "====================================================================="
	@echo "=                        clean successfully                         ="
	@echo "====================================================================="

